﻿CREATE DATABASE `portal` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `portal`;
DROP TABLE IF EXISTS `jsc_moduleproperty`;
CREATE TABLE  `jsc_moduleproperty` (
  `modulepropertyid` int(11) NOT NULL auto_increment,
  `name` varchar(40) NOT NULL default '',
  `description` varchar(100) default NULL,
  `propertytype` varchar(255) default NULL,
  `isrequired` tinyint(1) NOT NULL default '0',
  `moduletypeid` int(11) NOT NULL default '0',
  PRIMARY KEY  (`modulepropertyid`),
  KEY `IDX_cpc_moduleproperty_1` (`moduletypeid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_moduletype`;
CREATE TABLE  `jsc_moduletype` (
  `moduletypeid` int(11) NOT NULL auto_increment,
  `name` varchar(40) NOT NULL default '',
  `description` varchar(100) default NULL,
  `assemblyname` varchar(255) NOT NULL default '',
  `classname` varchar(255) NOT NULL default '',
  `controllername` varchar(255) NOT NULL default '',
  `viewname` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`moduletypeid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_page`;
CREATE TABLE  `jsc_page` (
  `pageid` int(11) NOT NULL auto_increment,
  `siteid` int(11) NOT NULL default '0',
  `language` varchar(5) NOT NULL default '',
  `name` varchar(40) NOT NULL default '',
  `description` varchar(100) default NULL,
  `templateid` int(11) default NULL,
  `parentid` int(11) default NULL,
  `friendlyurl` varchar(255) default NULL,
  `position` int(11) NOT NULL default '0',
  `showinnavigation` tinyint(1) default NULL,
  `validfrom` datetime NOT NULL default '0000-00-00 00:00:00',
  `validtill` datetime default NULL,
  `metakeywords` text,
  `metadescription` text,
  `createdby` int(11) default NULL,
  `modifiedby` int(11) default NULL,
  `createdtimestamp` datetime default NULL,
  `modifiedtimestamp` datetime default NULL,
  PRIMARY KEY  (`pageid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_pagerole`;
CREATE TABLE  `jsc_pagerole` (
  `pageroleid` int(11) NOT NULL auto_increment,
  `pageid` int(11) NOT NULL default '0',
  `roleid` int(11) NOT NULL default '0',
  `viewallowed` tinyint(1) NOT NULL default '0',
  `editallowed` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`pageroleid`),
  KEY `IDX_cpc_pagerole_1` (`pageid`),
  KEY `IDX_cpc_pagerole_2` (`roleid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_role`;
CREATE TABLE  `jsc_role` (
  `roleid` int(11) NOT NULL default '0',
  `name` varchar(40) NOT NULL default '',
  `description` varchar(100) default NULL,
  PRIMARY KEY  (`roleid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_section`;
CREATE TABLE  `jsc_section` (
  `sectionid` int(11) NOT NULL auto_increment,
  `name` varchar(40) NOT NULL default '',
  `description` varchar(100) default NULL,
  `pageid` int(11) default NULL,
  `moduletypeid` int(11) default NULL,
  `placeholder` varchar(255) NOT NULL default '',
  `position` int(11) NOT NULL default '0',
  `showname` tinyint(1) default '0',
  `validfrom` datetime NOT NULL default '0000-00-00 00:00:00',
  `validtill` datetime default NULL,
  `createdby` int(11) default NULL,
  `modifiedby` int(11) default NULL,
  `createdtimestamp` datetime default NULL,
  `modifiedtimestamp` datetime default NULL,
  PRIMARY KEY  (`sectionid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_sectionmodulepropertyvalue`;
CREATE TABLE  `jsc_sectionmodulepropertyvalue` (
  `sectionmodulepropertyvalueid` int(11) NOT NULL auto_increment,
  `sectionid` int(11) NOT NULL default '0',
  `modulepropertyid` int(11) NOT NULL default '0',
  `value` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`sectionmodulepropertyvalueid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_sectionrole`;
CREATE TABLE  `jsc_sectionrole` (
  `sectionroleid` int(11) NOT NULL auto_increment,
  `sectionid` int(11) NOT NULL default '0',
  `roleid` int(11) NOT NULL default '0',
  `viewallowed` tinyint(1) NOT NULL default '0',
  `editallowed` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`sectionroleid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_site`;
CREATE TABLE  `jsc_site` (
  `siteid` int(10) unsigned NOT NULL auto_increment,
  `defaulttemplateid` int(11) NOT NULL default '0',
  `name` varchar(50) NOT NULL default '',
  `description` varchar(255) default NULL,
  `url` varchar(50) NOT NULL default '',
  `defaultlanguage` varchar(5) NOT NULL default '',
  `webmastermail` varchar(255) NOT NULL default '',
  `validfrom` datetime NOT NULL default '0000-00-00 00:00:00',
  `validtill` datetime default NULL,
  `metakeywords` text,
  `metadescription` text,
  `createdby` int(11) default NULL,
  `modifiedby` int(11) default NULL,
  `createdtimestamp` datetime default NULL,
  `modifiedtimestamp` datetime default NULL,
  PRIMARY KEY  (`siteid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_sitelicense`;
CREATE TABLE  `jsc_sitelicense` (
  `sitelicenseid` int(10) unsigned NOT NULL auto_increment,
  `siteid` int(10) unsigned NOT NULL default '0',
  `moduletypeid` int(10) unsigned NOT NULL default '0',
  `licensed` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`sitelicenseid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_template`;
CREATE TABLE  `jsc_template` (
  `templateid` int(11) NOT NULL auto_increment,
  `name` varchar(40) NOT NULL default '',
  `description` varchar(40) default NULL,
  `path` varchar(255) NOT NULL default '',
  `controlname` varchar(255) NOT NULL default '',
  `css` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`templateid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_user`;
CREATE TABLE  `jsc_user` (
  `userid` int(11) NOT NULL auto_increment,
  `siteid` int(11) NOT NULL default '0',
  `username` varchar(40) NOT NULL default '',
  `password` varchar(128) NOT NULL default '',
  `passwordsalt` varchar(128) NOT NULL default '',
  `firstname` varchar(100) default NULL,
  `lastname` varchar(100) default NULL,
  `email` varchar(100) NOT NULL default '',
  `isactive` tinyint(1) NOT NULL default '0',
  `lastlogin` datetime default NULL,
  `lastip` varchar(16) default NULL,
  PRIMARY KEY  (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `jsc_userrole`;
CREATE TABLE  `jsc_userrole` (
  `userroleid` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL default '0',
  `roleid` int(11) NOT NULL default '0',
  PRIMARY KEY  (`userroleid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;